/*
api资源
*/
import { http, securityParams } from '@/util/http'

//登录资源
export const Login = {
    GetVerifyCode: (params) => {
        return http.get("/api/Login/GetVerifyCode", params);
    },
    GetJwt: (params) => {
        return http.post("/api/Login/GetJwt", securityParams(params));
    },
    RefreshToken: (params) => {
        return http.post("/api/Login/RefreshToken", securityParams(params));
    },
}
//即时通讯
export const IM = {
    PreConnect: (websocketId) => {
        return http.post(`/ws/pre-connect?websocketId=${websocketId}`, {});
    },
    GetChats: (websocketId) => {
        return http.get(`/ws/get-chats`, { websocketId });
    },
    SendMsg: (params) => {
        return http.post(`/ws/send-msg`, params);
    },
    SendChannelMsg: (params) => {
        return http.post(`/ws/send-channelmsg`, params);
    }
}
//个人基本资料资源
export const UserCenter = {
    //用户头像上传接口在avatar-upload组件中使用
    GetUserInfo: () => {
        return http.get("/adminApi/UserCenter/GetUserInfo", {});
    },
    ValidateOldPwd: (OldPwd) => {
        return http.get("/adminApi/UserCenter/ValidateOldPwd", { OldPwd: OldPwd });
    },
    Save: (params) => {
        return http.put("/adminApi/UserCenter/SaveForm", params);
    },
    RevisePassword: (params) => {
        return http.put("/adminApi/UserCenter/RevisePassword", params);
    },
}
//工具资源
export const Utility = {
    //预览图片接口在avatar-upload、CKEditor、Home组件中使用
    //富文本框图片上传接口在CKEditor组件中使用
    //下载导入错误标注文件接口在ImportFile组件中使用
    ClearRedis: () => {
        return http.put("/adminApi/Utility/ClearRedis", {});
    },
}
//附件资源
export const AnnexesFile = {
    //附件上传接口在UploadFile组件中使用
    //附件下载接口在UploadFile组件中使用
    GetAnnexesFileList: (folderId) => {
        return http.get("/adminApi/AnnexesFile/GetAnnexesFileList", { folderId: folderId });
    },
    DeleteAnnexesFile: (fileId) => {
        return http.put(`/adminApi/AnnexesFile/DeleteAnnexesFile?id=${fileId}`, {});
    },
}
//省市区资源
export const Ssq = {
    GetTreeList: (removeId) => {
        return http.getTree("/adminApi/Ssq/GetTreeList", {}, removeId);
    },
}
//日志资源
export const Log = {
    GetPageList: (params) => {
        return http.get("/adminApi/Log/GetPageList", params);
    },
    ClearLog: (params) => {
        return http.put("/adminApi/Log/ClearLog", params);
    },
}
//信息监控资源
export const Monitor = {
    GetApiByDay: () => {
        return http.get("/adminApi/Monitor/GetApiByDay", {});
    },
    GetApiByWeek: () => {
        return http.get("/adminApi/Monitor/GetApiByWeek", {});
    },
    GetApiByMonth: () => {
        return http.get("/adminApi/Monitor/GetApiByMonth", {});
    },
    GetApiByYear: () => {
        return http.get("/adminApi/Monitor/GetApiByYear", {});
    },
}
//权限资源
export const Authorize = {
    GetAuthList: () => {
        return http.get("/adminApi/Authorize/GetAuthList", {});
    },
    GetModuleTreeList: (objectId) => {
        return http.get("/adminApi/Authorize/GetModuleTreeList", { objectId: objectId });
    },
    GetButtonTreeList: (params) => {
        return http.post("/adminApi/Authorize/GetButtonTreeList", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Authorize/SaveForm", params);
    },
}
//数据字典资源
export const DataItem = {
    GetTreeList: (itemCode, removeId) => {
        return http.getTree("/adminApi/DataItem/GetTreeList", { B_ItemCode: itemCode }, removeId);
    },

    GetHeadTreeList: (removeId) => {
        return http.getTree("/adminApi/DataItem/GetHeadTreeList", {}, removeId);
    },
    DeleteHead: (params) => {
        return http.put("/adminApi/DataItem/DeleteHead", params);
    },
    SaveHead: (params) => {
        return http.put("/adminApi/DataItem/SaveHead", params);
    },
    ValidateHeadExist: (params) => {
        return http.get("/adminApi/DataItem/ValidateHeadExist", params);
    },

    GetDetailPageList: (params) => {
        return http.get("/adminApi/DataItem/GetDetailPageList", params);
    },
    GetDetailTreeList: (B_ItemId, removeId) => {
        return http.getTree("/adminApi/DataItem/GetDetailTreeList", { id: B_ItemId }, removeId);
    },
    DeleteDetail: (params) => {
        return http.put("/adminApi/DataItem/DeleteDetail", params);
    },
    SaveDetail: (params) => {
        return http.put("/adminApi/DataItem/SaveDetail", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/DataItem/ChangeState", params);
    },
    ValidateDetailExist: (params) => {
        return http.get("/adminApi/DataItem/ValidateDetailExist", params);
    }
}
//模块资源
export const Module = {
    GetTreeList: (removeId) => {
        return http.getTree("/adminApi/Module/GetTreeList", {}, removeId);
    },
    GetPageList: (params) => {
        return http.get("/adminApi/Module/GetPageList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/Module/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Module/SaveForm", params);
    },
    GetButtonList: (B_ModuleId) => {
        return http.get("/adminApi/Module/GetButtonList", { id: B_ModuleId });
    },
    ChangeState: (params) => {
        return http.put("/adminApi/Module/ChangeState", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Module/ValidateExist", params);
    }
}
//数据表资源
export const DatabaseTable = {
    GetList: () => {
        return http.get("/adminApi/DatabaseTable/GetList", {});
    },
    GetFieldList: (tableName) => {
        return http.get("/adminApi/DatabaseTable/GetFieldList", { tableName: tableName });
    },
}
//快速开发资源
export const CodeGenerator = {
    PreviewEntityCode: (params) => {
        return http.post("/adminApi/CodeGenerator/PreviewEntityCode", params);
    },
    GenerateEntityCode: (params) => {
        return http.put("/adminApi/CodeGenerator/GenerateEntityCode", params);
    },
    GetDefaultFieldList: (tableName) => {
        return http.get("/adminApi/CodeGenerator/GetDefaultFieldList", { tableName: tableName });
    },
    PreviewRepidCode: (params) => {
        return http.post("/adminApi/CodeGenerator/PreviewRepidCode", params);
    },
    GenerateRepidCode: (params) => {
        return http.put("/adminApi/CodeGenerator/GenerateRepidCode", params);
    },
}
//组织架构资源
export const Manaframe = {
    GetTreeList: (removeId) => {
        return http.getTree("/adminApi/Manaframe/GetTreeList", {}, removeId);
    },
    GetPageList: (params) => {
        return http.get("/adminApi/Manaframe/GetPageList", params);
    },
    GetList: (params) => {
        return http.get("/adminApi/Manaframe/GetList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/Manaframe/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Manaframe/SaveForm", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Manaframe/ValidateExist", params);
    }
}
//部门信息资源
export const Department = {
    GetTreeList: (params, removeId) => {
        return http.getTree("/adminApi/Department/GetTreeList", params, removeId);
    },
    GetPageList: (params) => {
        return http.get("/adminApi/Department/GetPageList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/Department/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Department/SaveForm", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/Department/ChangeState", params);
    },
    GetListByManaId: (params) => {
        return http.get("/adminApi/Department/GetListByManaId", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Department/ValidateExist", params);
    }
}
//岗位信息资源
export const Post = {
    GetTreeList: (params, removeId) => {
        return http.getTree("/adminApi/Post/GetTreeList", params, removeId);
    },
    GetPageList: (params) => {
        return http.get("/adminApi/Post/GetPageList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/Post/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Post/SaveForm", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/Post/ChangeState", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Post/ValidateExist", params);
    }
}
//角色信息资源
export const Role = {
    GetPageList: (params) => {
        return http.get("/adminApi/Role/GetPageList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/Role/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Role/SaveForm", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/Role/ChangeState", params);
    },
    GetListByManaId: (params) => {
        return http.get("/adminApi/Role/GetListByManaId", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Role/ValidateExist", params);
    }
}
//用户信息资源
export const User = {
    GetPageList: (params) => {
        return http.get("/adminApi/User/GetPageList", params);
    },
    Delete: (params) => {
        return http.put("/adminApi/User/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/User/SaveForm", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/User/ChangeState", params);
    },
    GetListByManaDepId: (params) => {
        return http.get("/adminApi/User/GetListByManaDepId", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/User/ValidateExist", params);
    }
}
//用户关系资源
export const UserRelation = {
    GetUserIdList: (objectId) => {
        return http.get("/adminApi/UserRelation/GetUserIdList", { objectId: objectId });
    },
    GetObjIdList: (userId) => {
        return http.get("/adminApi/UserRelation/GetObjIdList", { userId: userId });
    },
    Save: (params) => {
        return http.put("/adminApi/UserRelation/SaveForm", params);
    },
}
//编码规则资源
export const CodeRule = {
    GetList: (params) => {
        return http.get("/adminApi/CodeRule/GetList", { queryjson: params });
    },
    Delete: (params) => {
        return http.put("/adminApi/CodeRule/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/CodeRule/SaveForm", params);
    },
    GetFormatList: (B_RuleId) => {
        return http.get("/adminApi/CodeRule/GetFormatList", { id: B_RuleId });
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/CodeRule/ValidateExist", params);
    }
}
//定时任务资源
export const Job = {
    GetList: (params) => {
        return http.get("/adminApi/Job/GetList", { queryjson: params });
    },
    Delete: (params) => {
        return http.put("/adminApi/Job/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/Job/SaveForm", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/Job/ValidateExist", params);
    },
    QueryLocalJobCalls: () => {
        return http.get("/adminApi/Job/QueryLocalJobCalls");
    },
    ChangeState: (params) => {
        return http.put("/adminApi/Job/ChangeState", params);
    },
}
//应用接入配置资源
export const AppConfig = {
    GetList: (params) => {
        return http.get("/adminApi/AppConfig/GetList", { queryjson: params });
    },
    Delete: (params) => {
        return http.put("/adminApi/AppConfig/DeleteForm", params);
    },
    Save: (params) => {
        return http.put("/adminApi/AppConfig/SaveForm", params);
    },
    ChangeState: (params) => {
        return http.put("/adminApi/AppConfig/ChangeState", params);
    },
    ValidateExist: (params) => {
        return http.get("/adminApi/AppConfig/ValidateExist", params);
    }
}